scrapboxのページ中の同名のcode blockを結合して取り出
すscript
2021-07-29 03:51:21 fix typo
from /nishio/選択範囲をKeichoに尋ねるPopupMenu#61019f40aff09e0000c2c81a
scrapbox.Page.linesを使った方法
code:script.js
export function getCodeBlockText(fileName, lines) {
return lines.flatMap(({codeBlock, text}) => {
if (codeBlock?.filename !== fileName) return [];
// code:xxxの行は無視する
if (codeBlock?.start) return [];
// indentを削って返す
return text.slice(codeBlock?.indent ?? 0);
});
}
#コードブロック記法
#2021-07-29 03:51:07
#2021-07-24 16:04:17